import dt from '@dt/dt'
import orderApi from '@/config/server/api/order.js'

function save(info) {
  return orderApi.commission.rule.save.fetch(info)
}

function list(info) {
  return orderApi.commission.rule.list.fetch(info)
}

function detail(ruleId) {
  return orderApi.commission.rule.detail.fetch({ruleId})
}

function audit(ruleId, type, auditContent) { // 2 通过 3 驳回 
  return orderApi.commission.rule.audit.fetch({ruleId, type, auditContent})
}

function del(ruleId) {
  return audit(ruleId, 4)
}

function recall(ruleId) {
  return audit(ruleId, 1)
}

function buildList(info) {
  info.housesId = dt.buildInfo().housesId
  return orderApi.commission.rule.buildList.fetch(info)
}

export default {
  save,
  list,
  audit,
  detail,
  del,
  recall,
  buildList
}